<!--
 * @FilePath     : /study_code/vue2.x/slot-scope3.html
 * @Description  : slot-scope 属性定义作用域插槽
 * @Date         : 2025-05-02 20:17:37
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-05-02 20:17:48
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <div id="app">
      <slot-example>
        <template slot="default" slot-scope="slotProps">{{ slotProps.user.lastName }}</template>
      </slot-example>
    </div>

    <script src="/vue/dist/vue.min.js"></script>
    <script src="./common.js"></script>
    <script>
      const slotExample = {
        data: function () {
          return {
            user: {
              firstName: 'zhang',
              lastName: 'yida',
            },
          }
        },
        template: `
        <div>
          <slot :user="user">{{ user.firstName }}</slot>
        </div>
      `,
      }

      var vm = new Vue({
        el: '#app',
        data: function () {
          return {}
        },
        components: {
          'slot-example': slotExample,
        },
      })
    </script>
  </body>
</html>
